package com.nsgf.library.data.bean;

import android.os.Parcel;
import android.os.Parcelable;
import android.view.View;
import android.widget.ImageView;

import androidx.annotation.NonNull;
import androidx.databinding.BaseObservable;
import androidx.databinding.Bindable;
import androidx.databinding.BindingAdapter;

import com.nsgf.library.BR;
import com.nsgf.library.R;
import com.nsgf.library.data.api.APIs;
import com.nsgf.library.glide.GlideImgManager;
import com.nsgf.library.utils.Kits;
import com.nsgf.library.utils.StringUtil;

import java.io.Serializable;
import java.text.DecimalFormat;
import java.util.ArrayList;
import java.util.Calendar;
import java.util.List;

public class WorkOrderDetailBean extends BaseObservable implements Serializable {

    /**
     * code : 200
     * msg : success
     */

    private int code;
    private String msg;
    private DataBean data;

    @BindingAdapter("liveImage")
    public static void setCover(ImageView imageView, String cover) {
        GlideImgManager.getInstance().glideCenterCrop(imageView.getContext(), cover, imageView);
    }
    @BindingAdapter("headCover")
    public static void setHeadCover(ImageView imageView, String cover) {
        GlideImgManager.getInstance().glideLoaderCenterHeadCrop(imageView.getContext(), cover, imageView);
    }

    @BindingAdapter("abnormal")
    public static void setAbnormalCover(ImageView ivItemNsgfAbnormalTips, Boolean abnormal) {
        if (null == abnormal) {
            ivItemNsgfAbnormalTips.setVisibility(View.GONE);
        } else if (abnormal) {
            ivItemNsgfAbnormalTips.setVisibility(View.VISIBLE);
            ivItemNsgfAbnormalTips.setImageResource(R.drawable.ic_manager_work_order_error);
        } else {
            ivItemNsgfAbnormalTips.setImageResource(R.drawable.ic_manager_work_order_success);
            ivItemNsgfAbnormalTips.setVisibility(View.VISIBLE);
        }
    }

    public int getCode() {
        return code;
    }

    public void setCode(int code) {
        this.code = code;
    }

    public String getMsg() {
        return msg;
    }

    public void setMsg(String msg) {
        this.msg = msg;
    }

    public DataBean getData() {
        return data;
    }

    public void setData(DataBean data) {
        this.data = data;
    }

    public static class DataBean implements Serializable, Parcelable {
        /**
         * orderCode : DBXC20240920103610817250
         * startTime : null
         * endTime : null
         * safetyPhotoList : []
         * effect : null
         * confirmOpinions : null
         * endHandleTime : null
         * status : 1
         * abnormalList : []
         * isResponsibleBy : 0
         */

        private String orderCode;
        private BuProjectDailyBean buProjectDaily;
        private String startTime;
        private String endTime;
        private String effect;
        private String confirmOpinions;
        private String endHandleTime;
        private int status = 4;
        private int isResponsibleBy;
        private String planRoute;
        private List<PositionVOSBean> positionVOS;
        private List<FileDto> safetyPhotoList;
        private List<PtWorkOrderAbnormal> abnormalList;
        private String actualRoute;

        private String startHandleTime;
        private String inspector;
        private String inspectorReal;
        private String responsibleBy;
        private String responsibleByReal;

        private String approvalTime;
        private ArrayList<String> photos;
        private String patrolTypeDesc;

        public DataBean() {

        }

        protected DataBean(Parcel in) {
            orderCode = in.readString();
            startTime = in.readString();
            endTime = in.readString();
            effect = in.readString();
            confirmOpinions = in.readString();
            endHandleTime = in.readString();
            status = in.readInt();
            isResponsibleBy = in.readInt();
            planRoute = in.readString();
            positionVOS = in.createTypedArrayList(PositionVOSBean.CREATOR);
            actualRoute = in.readString();
            startHandleTime = in.readString();
            inspector = in.readString();
            responsibleBy = in.readString();
            approvalTime = in.readString();
            patrolTypeDesc = in.readString();
        }

        public static final Creator<DataBean> CREATOR = new Creator<DataBean>() {
            @Override
            public DataBean createFromParcel(Parcel in) {
                return new DataBean(in);
            }

            @Override
            public DataBean[] newArray(int size) {
                return new DataBean[size];
            }
        };

        @Override
        public int describeContents() {
            return 0;
        }

        @Override
        public void writeToParcel(@NonNull Parcel parcel, int i) {
            parcel.writeString(orderCode);
            parcel.writeString(startTime);
            parcel.writeString(endTime);
            parcel.writeString(effect);
            parcel.writeString(confirmOpinions);
            parcel.writeString(endHandleTime);
            parcel.writeInt(status);
            parcel.writeInt(isResponsibleBy);
            parcel.writeString(planRoute);
            parcel.writeTypedList(positionVOS);
            parcel.writeString(actualRoute);
            parcel.writeString(startHandleTime);
            parcel.writeString(inspector);
            parcel.writeString(responsibleBy);
            parcel.writeString(approvalTime);
            parcel.writeString(patrolTypeDesc);
        }

        public String getPlanRoute() {
            return planRoute;
        }

        public void setPlanRoute(String planRoute) {
            this.planRoute = planRoute;
        }

        public String getActualRoute() {
            return actualRoute;
        }

        public void setActualRoute(String actualRoute) {
            this.actualRoute = actualRoute;
        }

        public String getStartHandleTime() {
            if (StringUtil.isEmpty(startHandleTime)) {
                // 记录第一次巡检时间
                Calendar calendar = Calendar.getInstance();
                return Kits.Date.getYmdhmss(calendar.getTimeInMillis());
            } else
                return startHandleTime;
        }

        public void setStartHandleTime(String startHandleTime) {
            this.startHandleTime = startHandleTime;
        }

        public String getInspector() {
            return inspector;
        }

        public void setInspector(String inspector) {
            this.inspector = inspector;
        }

        public String getResponsibleBy() {
            return responsibleBy;
        }

        public void setResponsibleBy(String responsibleBy) {
            this.responsibleBy = responsibleBy;
        }

        public List<FileDto> getPhotos() {

            for (FileDto fileDto : getSafetyPhotoList()) {
                fileDto.setFilePath(APIs.BASE_URL_IMG + fileDto.getFilePath());
            }
            return getSafetyPhotoList();
        }

        public void setPhotos(ArrayList<String> photos) {
            this.photos = photos;
        }

        public String getApprovalTime() {
            return approvalTime;
        }

        public void setApprovalTime(String approvalTime) {
            this.approvalTime = approvalTime;
        }

        public String getPatrolTypeDesc() {
            return patrolTypeDesc;
        }

        public void setPatrolTypeDesc(String patrolTypeDesc) {
            this.patrolTypeDesc = patrolTypeDesc;
        }

        public String getInspectorReal() {
            return inspectorReal;
        }

        public void setInspectorReal(String inspectorReal) {
            this.inspectorReal = inspectorReal;
        }

        public String getResponsibleByReal() {
            return responsibleByReal;
        }

        public void setResponsibleByReal(String responsibleByReal) {
            this.responsibleByReal = responsibleByReal;
        }


        public static class PtWorkOrderAbnormal extends BaseObservable implements Serializable, Parcelable {

            /**
             * 主键
             */
            private String id;

            /**
             * 工单编号
             */
            private String orderCode;

            /**
             * 区域编码
             */
            private String areaCode;

            /**
             * 区域名称
             */
            private String areaName;

            /**
             * 部位编码
             */
            private String positionCode;

            /**
             * 部位名称
             */
            private String positionName;

            /**
             * 巡检项编码
             */
            private String itemCode;

            /**
             * 巡检项名称
             */
            private String itemName;

            /**
             * 结果类型
             */
            private String resultType;

            /**
             * 结果
             */
            private String resultValue;

            /**
             * 异常描述
             */
            private String abnormalDescribe;

            /**
             * 现场影像
             */
            private String liveImage;

            public static final Creator<PtWorkOrderAbnormal> CREATOR = new Creator<PtWorkOrderAbnormal>() {
                @Override
                public PtWorkOrderAbnormal createFromParcel(Parcel in) {
                    return new PtWorkOrderAbnormal(in);
                }

                @Override
                public PtWorkOrderAbnormal[] newArray(int size) {
                    return new PtWorkOrderAbnormal[size];
                }
            };

            public void setLiveImage(String liveImage) {
                this.liveImage = liveImage;
            }

            /**
             * 是否异常
             */
            private Boolean isAbnormal;

            private Boolean selectAbnormal;

            private List<FileDto> liveImageList;
            private int status;

            public PtWorkOrderAbnormal() {
            }

            protected PtWorkOrderAbnormal(Parcel in) {
                id = in.readString();
                orderCode = in.readString();
                areaCode = in.readString();
                areaName = in.readString();
                positionCode = in.readString();
                positionName = in.readString();
                itemCode = in.readString();
                itemName = in.readString();
                resultType = in.readString();
                resultValue = in.readString();
                abnormalDescribe = in.readString();
                liveImage = in.readString();
                byte tmpIsAbnormal = in.readByte();
                isAbnormal = tmpIsAbnormal == 0 ? null : tmpIsAbnormal == 1;
                byte tmpIsSelectAbnormal = in.readByte();
                selectAbnormal = tmpIsSelectAbnormal == 0 ? null : tmpIsSelectAbnormal == 1;

            }


            public List<FileDto> getLiveImageList() {
                return liveImageList;
            }

            public void setLiveImageList(List<FileDto> liveImageList) {
                this.liveImageList = liveImageList;
            }


            public Boolean getAbnormal() {
                return isAbnormal;
            }

            public void setAbnormal(Boolean abnormal) {
                isAbnormal = abnormal;
            }

            public String getLiveImage() {

                return liveImage;
            }

            public String getLiveImageSrc() {

                if (null == getLiveImageList())
                    return "";
                if (getLiveImageList().size() > 0) {
                    return APIs.BASE_URL_IMG + getLiveImageList().get(0).getFilePath();
                } else return "";

            }


            public String getAbnormalDescribe() {
                return abnormalDescribe;
            }

            public String getAbnormalDescribeSrc() {
                return "异常描述：" + abnormalDescribe;
            }

            public void setAbnormalDescribe(String abnormalDescribe) {
                this.abnormalDescribe = abnormalDescribe;
            }

            public String getResultType() {
                return resultType;
            }

            public void setResultType(String resultType) {
                this.resultType = resultType;
            }

            public String getResultValue() {
                return resultValue;
            }

            public void setResultValue(String resultValue) {
                this.resultValue = resultValue;
            }

            public String getPositionCode() {
                return positionCode;
            }

            public void setPositionCode(String positionCode) {
                this.positionCode = positionCode;
            }

            public String getAreaName() {
                return areaName;
            }

            public void setAreaName(String areaName) {
                this.areaName = areaName;
            }

            public String getId() {
                return id;
            }

            public void setId(String id) {
                this.id = id;
            }

            public String getOrderCode() {
                return orderCode;
            }

            public void setOrderCode(String orderCode) {
                this.orderCode = orderCode;
            }

            public String getAreaCode() {
                return areaCode;
            }

            public void setAreaCode(String areaCode) {
                this.areaCode = areaCode;
            }

            public String getPositionName() {
                return positionName;
            }

            public String getPositionNameSrc() {
                return "巡检部位：" + positionName;
            }

            public void setPositionName(String positionName) {
                this.positionName = positionName;
            }

            public String getItemCode() {
                return itemCode;
            }

            public void setItemCode(String itemCode) {
                this.itemCode = itemCode;
            }

            public String getItemName() {
                return itemName;
            }

            public String getItemNameSrc() {
                return "项目名称：" + itemName;
            }

            public void setItemName(String itemName) {
                this.itemName = itemName;
            }

            @Override
            public int describeContents() {
                return 0;
            }

            @Override
            public void writeToParcel(@NonNull Parcel parcel, int i) {
                parcel.writeString(id);
                parcel.writeString(orderCode);
                parcel.writeString(areaCode);
                parcel.writeString(areaName);
                parcel.writeString(positionCode);
                parcel.writeString(positionName);
                parcel.writeString(itemCode);
                parcel.writeString(itemName);
                parcel.writeString(resultType);
                parcel.writeString(resultValue);
                parcel.writeString(abnormalDescribe);
                parcel.writeString(liveImage);
                parcel.writeByte((byte) (isAbnormal == null ? 0 : isAbnormal ? 1 : 2));
                parcel.writeByte((byte) (selectAbnormal == null ? 0 : selectAbnormal ? 1 : 2));
            }

            public int getStatus() {
                return status;
            }

            public void setStatus(int status) {
                this.status = status;
            }

            @Bindable
            public Boolean getSelectAbnormal() {
                return selectAbnormal;
            }

            public void setSelectAbnormal(Boolean selectAbnormal) {
                this.selectAbnormal = selectAbnormal;
                notifyPropertyChanged(BR.selectAbnormal);
            }
        }

        public String getOrderCode() {
            return orderCode;
        }

        public void setOrderCode(String orderCode) {
            this.orderCode = orderCode;
        }

        public BuProjectDailyBean getBuProjectDaily() {
            return buProjectDaily;
        }

        public void setBuProjectDaily(BuProjectDailyBean buProjectDaily) {
            this.buProjectDaily = buProjectDaily;
        }

        public String getStartTime() {
            return startTime;
        }

        public void setStartTime(String startTime) {
            this.startTime = startTime;
        }

        public String getEndTime() {
            return endTime;
        }

        public void setEndTime(String endTime) {
            this.endTime = endTime;
        }

        public String getEffect() {
            return effect;
        }

        public void setEffect(String effect) {
            this.effect = effect;
        }

        public String getConfirmOpinions() {
            return StringUtil.isEmpty(confirmOpinions) ? "" : confirmOpinions;
        }

        public String getConfirmOpinionsSrc() {
            return getConfirmOpinions().length() + "/500";
        }

        public void setConfirmOpinions(String confirmOpinions) {
            this.confirmOpinions = confirmOpinions;
        }

        public String getEndHandleTime() {
            return endHandleTime;
        }

        public void setEndHandleTime(String endHandleTime) {
            this.endHandleTime = endHandleTime;
        }

        public int getStatus() {
            return status;
        }

        public void setStatus(int status) {
            this.status = status;
        }

        public int getIsResponsibleBy() {
            return isResponsibleBy;
        }

        public void setIsResponsibleBy(int isResponsibleBy) {
            this.isResponsibleBy = isResponsibleBy;
        }

        public List<PositionVOSBean> getPositionVOS() {
            return positionVOS;
        }

        public void setPositionVOS(List<PositionVOSBean> positionVOS) {
            this.positionVOS = positionVOS;
        }

        public List<FileDto> getSafetyPhotoList() {
            return safetyPhotoList;
        }

        public void setSafetyPhotoList(List<FileDto> safetyPhotoList) {
            this.safetyPhotoList = safetyPhotoList;
        }

        public List<PtWorkOrderAbnormal> getAbnormalList() {
            return abnormalList;
        }

        public void setAbnormalList(List<PtWorkOrderAbnormal> abnormalList) {
            this.abnormalList = abnormalList;
        }

        public static class BuProjectDailyBean implements Serializable, Parcelable {
            /**
             * id : 1836944700654710785
             * projectCode : 627B7001
             * date : 2024-09-20
             * weather : weather.type.3
             * weatherDesc : 雨
             * rainfall : 223
             * waterLevel : 11112
             * capacity : 3334
             */

            private String id;
            private String projectCode;
            private String date;
            private String weather;
            private String weatherDesc;
            private String rainfall;
            private String waterLevel;
            private String capacity;
            private String rainfallMonitor;
            private String waterLevelMonitor;

            public BuProjectDailyBean() {
            }

            protected BuProjectDailyBean(Parcel in) {
                id = in.readString();
                projectCode = in.readString();
                date = in.readString();
                weather = in.readString();
                weatherDesc = in.readString();
                rainfall = in.readString();
                waterLevel = in.readString();
                capacity = in.readString();
                rainfallMonitor = in.readString();
                waterLevelMonitor = in.readString();
            }

            public static final Creator<BuProjectDailyBean> CREATOR = new Creator<BuProjectDailyBean>() {
                @Override
                public BuProjectDailyBean createFromParcel(Parcel in) {
                    return new BuProjectDailyBean(in);
                }

                @Override
                public BuProjectDailyBean[] newArray(int size) {
                    return new BuProjectDailyBean[size];
                }
            };

            public String getId() {
                return id;
            }

            public void setId(String id) {
                this.id = id;
            }

            public String getProjectCode() {
                return projectCode;
            }

            public void setProjectCode(String projectCode) {
                this.projectCode = projectCode;
            }

            public String getDate() {
                return date;
            }

            public void setDate(String date) {
                this.date = date;
            }

            public String getWeather() {
                return weather;
            }

            public void setWeather(String weather) {
                this.weather = weather;
            }

            public String getWeatherDesc() {
                return weatherDesc;
            }

            public void setWeatherDesc(String weatherDesc) {
                this.weatherDesc = weatherDesc;
            }

            public String getRainfall() {
                return StringUtil.isEmpty(rainfall) ? getRainfallMonitor() : rainfall;
            }

            public void setRainfall(String rainfall) {
                this.rainfall = rainfall;
            }

            public String getWaterLevel() {

                String src = StringUtil.isEmpty(waterLevel) ? getWaterLevelMonitor() : waterLevel;

                if ("--".equals(src)) {
                    return "";
                }
                try {
                    return df.format(Double.parseDouble(src));
                } catch (Exception e) {
                    e.getMessage();
                    return waterLevel;
                }
            }

            public void setWaterLevel(String waterLevel) {
                this.waterLevel = waterLevel;
            }

            public String getCapacity() {
                return capacity;
            }

            public void setCapacity(String capacity) {
                this.capacity = capacity;
            }

            public String getRainfallMonitor() {
                return StringUtil.isEmpty(rainfallMonitor) ? "" : rainfallMonitor;
            }

            public String getRainfallMonitorSrc() {
                return StringUtil.isEmpty(rainfallMonitor) ? "--" : rainfallMonitor;
            }

            public void setRainfallMonitor(String rainfallMonitor) {
                this.rainfallMonitor = rainfallMonitor;
            }

            private DecimalFormat df = new DecimalFormat("#####0.00");

            public String getWaterLevelMonitor() {
                String src = StringUtil.isEmpty(waterLevelMonitor) ? "--" : waterLevelMonitor;
                if ("--".equals(src)) {
                    return src;
                }
                try {
                    return df.format(Double.parseDouble(src));
                } catch (Exception e) {
                    e.getMessage();
                    return waterLevelMonitor;
                }
            }

            public void setWaterLevelMonitor(String waterLevelMonitor) {
                this.waterLevelMonitor = waterLevelMonitor;
            }

            @Override
            public int describeContents() {
                return 0;
            }

            @Override
            public void writeToParcel(@NonNull Parcel parcel, int i) {
                parcel.writeString(id);
                parcel.writeString(projectCode);
                parcel.writeString(date);
                parcel.writeString(weather);
                parcel.writeString(weatherDesc);
                parcel.writeString(rainfall);
                parcel.writeString(waterLevel);
                parcel.writeString(capacity);
                parcel.writeString(rainfallMonitor);
                parcel.writeString(waterLevelMonitor);
            }
        }

        public static class PositionVOSBean implements Serializable, Parcelable {
            /**
             * areaCode : 1817748672943886336
             * areaName : 11
             * positionCode : 1816661582059540480
             * positionName : 近坝水面
             * lon : 120.19791059019236
             * lat : 32.929673194885254
             */

            private String areaCode;
            private String areaName;
            private String positionCode;
            private String positionName;
            private String lon;
            private String lat;
            private List<ItemsBean> items;

            /**
             * status 1已巡查-绿色 2漏巡查-红色 3正在巡查-蓝色 4未巡查-灰色
             */
            private int status;

            public PositionVOSBean() {
            }


            protected PositionVOSBean(Parcel in) {
                areaCode = in.readString();
                areaName = in.readString();
                positionCode = in.readString();
                positionName = in.readString();
                lon = in.readString();
                lat = in.readString();
                items = in.createTypedArrayList(ItemsBean.CREATOR);
                status = in.readInt();
            }

            @Override
            public void writeToParcel(Parcel dest, int flags) {
                dest.writeString(areaCode);
                dest.writeString(areaName);
                dest.writeString(positionCode);
                dest.writeString(positionName);
                dest.writeString(lon);
                dest.writeString(lat);
                dest.writeTypedList(items);
                dest.writeInt(status);
            }

            @Override
            public int describeContents() {
                return 0;
            }

            public static final Creator<PositionVOSBean> CREATOR = new Creator<PositionVOSBean>() {
                @Override
                public PositionVOSBean createFromParcel(Parcel in) {
                    return new PositionVOSBean(in);
                }

                @Override
                public PositionVOSBean[] newArray(int size) {
                    return new PositionVOSBean[size];
                }
            };

            public String getAreaCode() {
                return areaCode;
            }

            public void setAreaCode(String areaCode) {
                this.areaCode = areaCode;
            }

            public String getAreaName() {
                return areaName;
            }

            public void setAreaName(String areaName) {
                this.areaName = areaName;
            }

            public String getPositionCode() {
                return positionCode;
            }

            public void setPositionCode(String positionCode) {
                this.positionCode = positionCode;
            }

            public String getPositionName() {
                return positionName;
            }

            public void setPositionName(String positionName) {
                this.positionName = positionName;
            }

            public String getLon() {
                return lon;
            }

            public void setLon(String lon) {
                this.lon = lon;
            }

            public String getLat() {
                return lat;
            }

            public void setLat(String lat) {
                this.lat = lat;
            }

            public List<ItemsBean> getItems() {
                return items;
            }

            public void setItems(List<ItemsBean> items) {
                this.items = items;
            }

            public int getStatus() {
                return status;
            }

            public void setStatus(int status) {
                this.status = status;
            }


            public static class ItemsBean extends BaseObservable implements Parcelable {
                /**
                 * areaCode : 1817748672943886336
                 * areaName : 11
                 * positionCode : 1816661582059540480
                 * positionName : 近坝水面
                 * itemCode : 1816661582105677824
                 * itemName : 冒泡、旋涡等
                 * resultType : sel
                 * isRequire : 1
                 * options : ["无","有"]
                 * value : ["无"]
                 */

                private String areaCode;
                private String areaName;
                private String positionCode;
                private String positionName;
                private String itemCode;
                private String itemName;
                private String resultType;
                private int isRequire;
                private List<ResultsBean> results;
                private List<String> options;
                private List<String> value;
                private int viewGone = View.GONE;
                private boolean check;
                private String abnormalDescribe;
                private String resultValue;
                private List<FileDto> liveImageList;

                public List<FileDto> getPhotos() {
                    return getLiveImageList();
                }

                protected ItemsBean(Parcel in) {
                    areaCode = in.readString();
                    areaName = in.readString();
                    positionCode = in.readString();
                    positionName = in.readString();
                    itemCode = in.readString();
                    itemName = in.readString();
                    resultType = in.readString();
                    isRequire = in.readInt();
                    options = in.createStringArrayList();
                    value = in.createStringArrayList();
                    abnormalDescribe = in.readString();
                }

                public static final Creator<ItemsBean> CREATOR = new Creator<ItemsBean>() {
                    @Override
                    public ItemsBean createFromParcel(Parcel in) {
                        return new ItemsBean(in);
                    }

                    @Override
                    public ItemsBean[] newArray(int size) {
                        return new ItemsBean[size];
                    }
                };

                public String getAreaCode() {
                    return areaCode;
                }

                public void setAreaCode(String areaCode) {
                    this.areaCode = areaCode;
                }

                public String getAreaName() {
                    return areaName;
                }

                public void setAreaName(String areaName) {
                    this.areaName = areaName;
                }

                public String getPositionCode() {
                    return positionCode;
                }

                public void setPositionCode(String positionCode) {
                    this.positionCode = positionCode;
                }

                public String getPositionName() {
                    return positionName;
                }

                public void setPositionName(String positionName) {
                    this.positionName = positionName;
                }

                public String getItemCode() {
                    return itemCode;
                }

                public void setItemCode(String itemCode) {
                    this.itemCode = itemCode;
                }

                public String getItemName() {
                    return itemName;
                }

                public void setItemName(String itemName) {
                    this.itemName = itemName;
                }

                public String getResultType() {
                    return resultType;
                }

                public void setResultType(String resultType) {
                    this.resultType = resultType;
                }

                public int getIsRequire() {
                    return isRequire;
                }

                public void setIsRequire(int isRequire) {
                    this.isRequire = isRequire;
                }

                public List<ResultsBean> getResults() {
                    return results;
                }

                public void setResults(List<ResultsBean> results) {
                    this.results = results;
                }

                public List<String> getOptions() {
                    if (null == options)
                        options = new ArrayList<>();
                    return options;
                }

                public void setOptions(List<String> options) {
                    this.options = options;
                }

                public List<String> getValue() {
                    return value;
                }

                public String getValueSrc() {
                    if (!value.isEmpty())
                        return value.get(0);
                    return "";
                }

                public String getValueAndResultValue() {
                    if (StringUtil.isEmpty(getResultValue()))
                        if (!value.isEmpty())
                            return value.get(0);
                        else return "";
                    else return getResultValue();
                }

                public void setValue(List<String> value) {
                    this.value = value;
                }

                @Override
                public int describeContents() {
                    return 0;
                }

                @Override
                public void writeToParcel(@NonNull Parcel parcel, int i) {
                    parcel.writeString(areaCode);
                    parcel.writeString(areaName);
                    parcel.writeString(positionCode);
                    parcel.writeString(positionName);
                    parcel.writeString(itemCode);
                    parcel.writeString(itemName);
                    parcel.writeString(resultType);
                    parcel.writeInt(isRequire);
                    parcel.writeStringList(options);
                    parcel.writeStringList(value);
                    parcel.writeString(abnormalDescribe);
                }

                @Bindable
                public int getViewGone() {
                    return viewGone;
                }

                public void setViewGone(int viewGone) {
                    this.viewGone = viewGone;
                    notifyPropertyChanged(BR.viewGone);
                }

                public boolean isCheck() {
                    return check;
                }

                public void setCheck(boolean check) {
                    this.check = check;
                }

                public String getAbnormalDescribe() {
                    return StringUtil.isEmpty(abnormalDescribe) ? "" : abnormalDescribe;
                }

                public String getAbnormalDescribeSrc() {
                    return getAbnormalDescribe().length() + "/500";
                }


                public void setAbnormalDescribe(String abnormalDescribe) {
                    this.abnormalDescribe = abnormalDescribe;
                }

                public String getResultValue() {
                    return resultValue;
                }

                public void setResultValue(String resultValue) {
                    this.resultValue = resultValue;
                }

                public List<FileDto> getLiveImageList() {
                    return liveImageList;
                }

                public List<FileDto> getLiveImageListSubmit() {
                    if (null == getLiveImageList())
                        return null;
                    List<FileDto> fileDtos = getLiveImageList();
                    for (int i = 0; i < fileDtos.size(); i++) {
                        fileDtos.get(i).setFilePath(fileDtos.get(i).getFilePath().replace(APIs.BASE_URL_IMG, ""));
                    }
                    return fileDtos;
                }

                public void setLiveImageList(List<FileDto> liveImageList) {
                    this.liveImageList = liveImageList;
                }

                public static class ResultsBean {
                    /**
                     * areaCode : 1817748672943886336
                     * areaName : 11
                     * positionCode : 1816661582059540480
                     * positionName : 近坝水面
                     * itemCode : 1816661582105677824
                     * itemName : 冒泡、旋涡等
                     * resultType : sel
                     * resultTypeDesc : null
                     * isRequire : 1
                     * resultCode : 1816661582185275393
                     * resultName : 无
                     * isDefault : 1
                     */

                    private String areaCode;
                    private String areaName;
                    private String positionCode;
                    private String positionName;
                    private String itemCode;
                    private String itemName;
                    private String resultType;
                    private String resultTypeDesc;
                    private int isRequire;
                    private String resultCode;
                    private String resultName;
                    private int isDefault;

                    public String getAreaCode() {
                        return areaCode;
                    }

                    public void setAreaCode(String areaCode) {
                        this.areaCode = areaCode;
                    }

                    public String getAreaName() {
                        return areaName;
                    }

                    public void setAreaName(String areaName) {
                        this.areaName = areaName;
                    }

                    public String getPositionCode() {
                        return positionCode;
                    }

                    public void setPositionCode(String positionCode) {
                        this.positionCode = positionCode;
                    }

                    public String getPositionName() {
                        return positionName;
                    }

                    public void setPositionName(String positionName) {
                        this.positionName = positionName;
                    }

                    public String getItemCode() {
                        return itemCode;
                    }

                    public void setItemCode(String itemCode) {
                        this.itemCode = itemCode;
                    }

                    public String getItemName() {
                        return itemName;
                    }

                    public void setItemName(String itemName) {
                        this.itemName = itemName;
                    }

                    public String getResultType() {
                        return resultType;
                    }

                    public void setResultType(String resultType) {
                        this.resultType = resultType;
                    }

                    public String getResultTypeDesc() {
                        return resultTypeDesc;
                    }

                    public void setResultTypeDesc(String resultTypeDesc) {
                        this.resultTypeDesc = resultTypeDesc;
                    }

                    public int getIsRequire() {
                        return isRequire;
                    }

                    public void setIsRequire(int isRequire) {
                        this.isRequire = isRequire;
                    }

                    public String getResultCode() {
                        return resultCode;
                    }

                    public void setResultCode(String resultCode) {
                        this.resultCode = resultCode;
                    }

                    public String getResultName() {
                        return resultName;
                    }

                    public void setResultName(String resultName) {
                        this.resultName = resultName;
                    }

                    public int getIsDefault() {
                        return isDefault;
                    }

                    public void setIsDefault(int isDefault) {
                        this.isDefault = isDefault;
                    }
                }
            }
        }
    }

    public static class FileDto implements Serializable {
        private String fileName;
        private String filePath;
        private long fileSize;
        private Integer isDelete;

        public FileDto() {
        }

        protected FileDto(Parcel in) {
            fileName = in.readString();
            filePath = in.readString();
            fileSize = in.readLong();
            if (in.readByte() == 0) {
                isDelete = null;
            } else {
                isDelete = in.readInt();
            }
        }

        public Integer getIsDelete() {
            return isDelete;
        }

        public void setIsDelete(Integer isDelete) {
            this.isDelete = isDelete;
        }

        public long getFileSize() {
            return fileSize;
        }

        public void setFileSize(long fileSize) {
            this.fileSize = fileSize;
        }

        public String getFilePath() {
            return filePath;
        }

        public void setFilePath(String filePath) {
            this.filePath = filePath;
        }

        public String getFileName() {
            return fileName;
        }

        public void setFileName(String fileName) {
            this.fileName = fileName;
        }

    }
}
